package com.cx.service.lq.Impl;

import com.cx.mapper.UserMapper;
import com.cx.pojo.User;
import com.cx.service.lq.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    public User selectByUserNameAndPwd(String userName, String pwd) {
        // userMapper 根据用户名与密码进行查找即可
        User user = userMapper.selectByUserNameAndPwd(userName,pwd);
        return user;
    }

    @Override
    public int changePassword(int userId, String newPassword) {
        int affect = userMapper.changePassword(userId,newPassword);
        return affect;
    }

    @Override
    public String findByUserId(int userId) {
        return userMapper.findByUserId(userId);
    }

    @Override
    public int  register(String userName,String userPassword,String userPhone) {
       int affect= userMapper.register(userName,userPassword,userPhone);
       return affect;
    }

    @Override
    public int selectUserName(String userName) {
        int affect= userMapper.selectUserName(userName);
        return affect;
    }
}
